package org.jeecg.modules.crm.service.impl;

import org.jeecg.modules.crm.entity.SalesKit;
import org.jeecg.modules.crm.entity.SalesKitDescription;
import org.jeecg.modules.crm.entity.SalesKitPriceChart;
import org.jeecg.modules.crm.entity.SalesKitSitePlan;
import org.jeecg.modules.crm.entity.SalesKitUnitPlan;
import org.jeecg.modules.crm.entity.SalesKitFacilities;
import org.jeecg.modules.crm.entity.SalesKitGallery;
import org.jeecg.modules.crm.entity.SalesKitVideo;
import org.jeecg.modules.crm.entity.SalesKitDocument;
import org.jeecg.modules.crm.entity.SalesKitFaq;
import org.jeecg.modules.crm.mapper.SalesKitDescriptionMapper;
import org.jeecg.modules.crm.mapper.SalesKitPriceChartMapper;
import org.jeecg.modules.crm.mapper.SalesKitSitePlanMapper;
import org.jeecg.modules.crm.mapper.SalesKitUnitPlanMapper;
import org.jeecg.modules.crm.mapper.SalesKitFacilitiesMapper;
import org.jeecg.modules.crm.mapper.SalesKitGalleryMapper;
import org.jeecg.modules.crm.mapper.SalesKitVideoMapper;
import org.jeecg.modules.crm.mapper.SalesKitDocumentMapper;
import org.jeecg.modules.crm.mapper.SalesKitFaqMapper;
import org.jeecg.modules.crm.mapper.SalesKitMapper;
import org.jeecg.modules.crm.service.ISalesKitService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: Sales Kit
 * @Author: jeecg-boot
 * @Date:   2025-04-22
 * @Version: V1.0
 */
@Service
public class SalesKitServiceImpl extends ServiceImpl<SalesKitMapper, SalesKit> implements ISalesKitService {

	@Autowired
	private SalesKitMapper salesKitMapper;
	@Autowired
	private SalesKitDescriptionMapper salesKitDescriptionMapper;
	@Autowired
	private SalesKitPriceChartMapper salesKitPriceChartMapper;
	@Autowired
	private SalesKitSitePlanMapper salesKitSitePlanMapper;
	@Autowired
	private SalesKitUnitPlanMapper salesKitUnitPlanMapper;
	@Autowired
	private SalesKitFacilitiesMapper salesKitFacilitiesMapper;
	@Autowired
	private SalesKitGalleryMapper salesKitGalleryMapper;
	@Autowired
	private SalesKitVideoMapper salesKitVideoMapper;
	@Autowired
	private SalesKitDocumentMapper salesKitDocumentMapper;
	@Autowired
	private SalesKitFaqMapper salesKitFaqMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		salesKitDescriptionMapper.deleteByMainId(id);
		salesKitPriceChartMapper.deleteByMainId(id);
		salesKitSitePlanMapper.deleteByMainId(id);
		salesKitUnitPlanMapper.deleteByMainId(id);
		salesKitFacilitiesMapper.deleteByMainId(id);
		salesKitGalleryMapper.deleteByMainId(id);
		salesKitVideoMapper.deleteByMainId(id);
		salesKitDocumentMapper.deleteByMainId(id);
		salesKitFaqMapper.deleteByMainId(id);
		salesKitMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			salesKitDescriptionMapper.deleteByMainId(id.toString());
			salesKitPriceChartMapper.deleteByMainId(id.toString());
			salesKitSitePlanMapper.deleteByMainId(id.toString());
			salesKitUnitPlanMapper.deleteByMainId(id.toString());
			salesKitFacilitiesMapper.deleteByMainId(id.toString());
			salesKitGalleryMapper.deleteByMainId(id.toString());
			salesKitVideoMapper.deleteByMainId(id.toString());
			salesKitDocumentMapper.deleteByMainId(id.toString());
			salesKitFaqMapper.deleteByMainId(id.toString());
			salesKitMapper.deleteById(id);
		}
	}
	
}
